/*************************************************************
 * File: Operator.java
 * Copyright (c) 2012
 * Author: Huang Shaobin
 * Email: Shaobin.Software@gmail.com Shaobin_Software@163.com 
 * Date: Feb 21, 2013
 * Description: 
 ************************************************************/

package snow.core.persistence;

import org.apache.commons.lang.ObjectUtils;

/**
 * 运算符
 * 
 * @author Shaobin.Software@gmail.com Shaobin_Software@163.com 
 * @version 1.0 
 */
public class Operator {

	public static final Operator IN = new Operator("IN");
	public static final Operator IS_NULL = new Operator("IS NULL");
	public static final Operator NOT_NULL = new Operator("IS NOT NULL");
	public static final Operator BETWEEN = new Operator("BETWEEN");

	private String sign;

	protected Operator(String sign) {
		this.sign = sign;
	}

	public boolean equals(Object obj) {
		if (obj instanceof Operator) {
			return ObjectUtils.equals(getSign(), ((Operator) obj).getSign());
		}
		return super.equals(obj);
	}

	public String getSign() {
		return this.sign;
	}

	public int hashCode() {
		return ObjectUtils.hashCode(getSign());
	}

	public String toString() {
		return getSign();
	}
}
